home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Amoszine 7
/
Amoszine 7 (Disk 1 of 3).adf
/
ARTS
/
MA_POWER_BOBS_DOC.asc.cm
/
MA_POWER_BOBS_DOC.asc.cm
Wrap
Text File
|
1995-06-03
|
34KB
|
1,042 lines
E0P3 Power Bobs doc file. (18/05/1995) V1.0P1
P3 byP1
P3 Manuel Andre P1E3
P5
We were hoping to give you a Shareware version of Powerbobs to try out. But the
late post between England to Belgium, only allows us to show you this document.
The extension itself will be on the next issue of the Amoszine, it already has
some new features, which are not listed here.
P1
For those of you who can't wait, you can try out the shareware version of
Powerbobs by sending a
SAE & disk to:-
P3POWERBOBS
27 BARTON ROAD
MAIDSTONE
KENT
ME15 7BU
ENGLANDP1
P3What is this anyway?
====================
P1
A HIGH-speed AMOS/Pro extension, adding numerous new commands to give your
work the extra speed AMOS/Pro lacks.
It is in fact a welcome addition to the AMOS/Pro Turbo Plus extension, also
written by me.
Included are :
Pbobs replacing the entire AMOS/Pro Bob system.
Psprites replacing the entire AMOS/Pro Sprite system.
Pbob and Psprite Amal support.
New Amal command allowing all 64 channels to run under interrupts!
Superfast collision detection for each type of object using coordinate
checking.
Various commands allowing arithmetics on entire arrays (a lot faster).
Probably some BUGS... :-)
Excluded are :
All commands/functions you failed to mention. ;-)
P3Why SHAREWARE?
==============
P1
It allows you to try the extension first, and if satisfied, you can
decide to buy it for a fair price.
It allows me to get full control on the development and sales of this extension
without deadlines and without seeing the fee disappear in someone elses
pocket.
P3Main PowerBob commands.
=======================
P4Reserve Pbobs
P1
Reserve Pbobs AMOUNT
Reserves a static memory list for AMOUNT of Pbobs.
You can reserve a list for a maximum of 64 Pbobs.
I can change this if you want more of them, but 64 seems to be
enough for most applications...
Bytes reserved : AMOUNT * 8
Type of memory : Chip or Fast if available.
P4Pbob Erase
P1
Pbob Erase
Erase all Pbobs and their structure. This instruction is executed
internally every time you run the AMOS/Pro program or when leaving
AMOS/Pro.
P4Pbob Dbuf
P1
Pbob Dbuf True/False
If you are going to use Pbobs with the double buffering system, set it
to True. Else set it to False.
This command MUST preceed all following commands !
P4Pbob Height
P1
Pbob Height NR,MAXIMUM_HEIGHT
Reserves a PBOB_STRUCTURE for Pbob NR and initialises it with default
values.
If Pbob Dbuf is set to True, a second PBOB_STRUCTURE will be reserved
for use with the double buffering system.
Bytes reserved : PBOB_STRUCTURE Chip or Fast if available.
MAXIMUM_HEIGHT * 36 Chip
\--> 6 bytes for each line to save * 6 bitplanes.
(See Pbob instruction for more details)
If Pbob Dbuf is set to True, the amount of bytes reserved
is doubled.
P4Pbob
P1
Pbob NR,X,Y,IMAGE
Does almost the same thing as the normal Bob command.
The only differences are :
1) the maximum width of the IMAGE is 32 pixels wide.
There are no restrictions on the height of the Pbob.
2) the height of the IMAGE that will be displayed may NOT exceed
the maximum height for this Pbob.
See the Pbob Height command.
3) the amount of colours of the IMAGE may NOT exceed the amount
of screen colours where the Pbob will be displayed.
Else a crash is certain!
So if you open a screen with 4 colours, do not try to display a Pbob
with 8 or more colours. But it is valid to, for example, to open a screen
with 32 colours and display Pbob's with fewer colours (bitplanes).
Only the bitplanes defining the Pbob will be copied on screen.
4) all parameters must be included.
5) the Pbob numbering starts at 1, not 0 like the AMOS/Pro Bobs...
6) it is important to know that the coordinates for the Pbob's are
measured from the top left-hand corner of the image.
The current hot spot setting in not taken into account!
7) the Pbob commands have to be executed in the screen where they are
to be displayed !
This is because a part of the Clipping routine is done inside the
Pbob command.
Ex.:
Repeat
Screen 1
Proc UPDATE_SCORE
Screen 0
Proc MOVE_BADDIES : Rem move the BAD_GUYS with Pbob NR,X,Y,IMAGE
Proc MOVE_GOODIE : Rem move the GOOD_GUYS with Pbob NR,X,Y,IMAGE
Proc UPDATE_BADDIES_AND_GOODIES :Rem Pbob Clear
rem Pbob Draw:Screen Swap : Wait Vbl
Until AMOUNT_OF_GOODIES=0
Pbob ARRAY_X,ARRAY_Y,ARRAY_IMAGE,START_BOB To END_BOB
This is a superfast replacement for the original Pbob command.
Normally you have to define all Pbob's whithin a loop like this :
For I=START_BOB To END_BOB
Pbob I,ARRAY_X(I),ARRAY_Y(I),ARRAY_IMAGE(I)
Next I
This loop can be replaced with one command !
Pbob Varptr(ARRAY_X(N)),Varptr(ARRAY_Y(N)),Varptr(ARRAY_IMAGE(N)),START_BOB
To END_BOB
It looks very complicated and slow because of the use of the Varptr()
functions, but when compiled it is very effective and fast.
(I know this for sure, because I've examined the resulting compiled code...)
Varptr(N) is only returning the adress where the N th element of the array
is stored in memory. N doesn't have to be zero, you can start from any
element in the array, passing the values to the Pbob's.
It is also possible to use AMOS/Pro banks for storing the X/Y coordinates
and the Image of the Pbob's.
Beware, the X/Y and Image values stored in the banks have to be LONGWORDS
(32 bits).
It has been carefully optimised to give the best speed possible!
A few tests, normally done by the usual Pbob command, have been
ommited.
1) It does not check if the Pbob IMAGE is wider than 32 pixels.
2) It does not check if the HEIGHT of the Pbob IMAGE exceeds the
maximum height for this Pbob.
3) Also the lenght of the ARRAY's or Banks are not checked for !
So I advise you to test your program in the usual manner and, if
everything works fine, you can use the new version of the Pbob
command.
P4Pbob Off
P1
Pbob Off NR
Does the same thing as the Amos Bob Off NR command...
Pbob Off START To END
Discard a range of Pbobs.
Pbob Off
Does the same thing as the Amos Bob Off command...
P4Set Pbob
P1
Set Pbob NR,REPLACE_MODE,PLANEMASK
Set Pbob drawing mode.
There are two types of REPLACE_MODE :
1) a value of 0 will save and restore the background under your Pbob,
this is the default value.
2) any other value will turn off the save and restore process.
The PLANEMASK is a bit-map, defining which plane(s) of the Pbob will be
copied onto the screen.
If a bit is set to zero, this particular plane of the Pbob will not
be copied onto the screen.
Ex.: Set Pbob 1,0,%100001 --> copy plane 6 and 1 onto the screen.
plane 654321
P4Set Fastpbob Mode
P1
Set Fastpbob Mode True/False
This is a global swith, turning off the background saving/restoring process
for ALL Pbob's when set to True.
If set to False, every Pbob will be checked for, to see if the background
saving/restoring process has to be done.
By default, this switch is allways set to False.
P4Pbob Update
P1
Pbob Update
Does the same thing as the Amos Bob Update command, except that
the Logical and Physical Screens are not swapped.
This allows a better control on the updating process if you are using
multiple double buffered screens.
P4Pbob Clear
P1
Pbob Clear START_BOB To END_BOB
Clear a range of Pbobs by restoring the original background.
P4Pbob Draw
P1
Pbob Draw START_BOB To END_BOB
Draw a range of Pbobs on screen.
P4Pdraw 25fps
P1
Pdraw 25fps True/False
Set the Pbob Clear and Pbob Draw command in 25 frames per second
mode.
When you run your program, it is allways reset to 50 frames per second!
Beware, this mode does not influence the Pbob Update command!
In ProjectX and Alien Breed and quite a lot of other games, the main
Sprite etc., is updated at 50 frames per second, but the Bobs are only
updated at 25 frames per second.
So the program looks like this:
DO
`
A=1-A : rem a simple toggle 1st frame = 1, next frame =0 etc
`
`
READ JOYSTICK AND STUFF EVERY FRAME
`
`
If A=1
CLEAR ALL BOBS
`
Pbob Clear 1 To 20
CALCULATE NEW POSTIONS FOR BOBS 11 TO 20
`
Pbob DRAW 11 TO 20
ETC.......
`
Else
`
CALCALCULATE NEW POSTIONS FOR BOBS 1 TO 10
`
Pbob Draw 1 TO 10
ETC.....
'
Screen Swap
'
End If
'UPDATE MAIN SPRITE EVERY FRAME
Sprite 0,X,Y,3
Wait Vbl
Loop
As you can see, Pbobs 11 to 20 are drawn in the first frame.
The next frame, Pbobs 1 to 10 are drawn and screen swapped into view.
But the joystick reading and anything else are updated every frame!
P4Pswap Clear
P1 In the old Pbob Clear command the background buffer adresses where
swapped inside the Pbob Clear command.
Normally you used to do :
Pbob Clear
Screen Swap
Pbob Clear
The new way is :
Pbob Clear START_BOB To END_BOB
Screen Swap
Pswap Clear
Pbob Clear START_BOB To END_BOB
P3PowerBob functions.
-------------------
P1
P4=I Pbob()
P1
IMAGE=I Pbob(NR)
Return the actual image for Pbob NR.
P4=X Pbob()
P1
X=X Pbob(NR)
Return X coordinate of Pbob NR.
P4=Y Pbob()
P1
Y=Pbob Y(NR)
Return Y coordinate of Pbob NR.
P3Main PowerSprite commands.
==========================
P4
Set Psprite Colours
P1
Set Psprite Colours AMOUNT
Set the amount of colours for the Psprites.
This command MUST be executed before the Convert Sprites BNKNR command!
You can set it to 4 or 16 colours, but you have to be sure that all
Sprites in the bank to convert share the same amount of colours (bitplanes).
P4Convert Sprites
P1
Convert Sprites BANKNR
Convert all Sprites in bank BANKNR to special hardware format.
As you know, Bob's and Sprites share the same format in memory.
Normally, when displaying a Sprite, it has to be converted into the
special hardware format (interleaved bitplane format), before it
can be displayed by the Sprite DMA-channels.
The Psprite commands skip this conversion giving an enormous speed-gain!
It is best to keep you Sprites and Bobs into separate banks, because
this command will convert all Bobs/Sprites in the bank, wasting a lot
of your precious memory !
At this moment the conversion works fine for 4 or 16 coloured Sprites
that are 16 pixels wide, any height is allowed.
When the conversion process is done, the original bank can be erased from
memory, because the converted images are stored in a different format
and memory location.
You can even replace the converted bank by another one!
P4Psprite Max
P1
Psprite Max AMOUNT
Set the maximum amount of Psprites that will be used.
A maximum of 128 Psprites is allowed !
By default it is set to 64, so Psprite 0 to 63 can be used.
P4Psprite NR,X,Y,IMAGE
P1 Does the same thing as the AMOS/Pro command.
All parameters must be given !
P4Psprite ARRAY_X,ARRAY_Y,ARRAY_IMAGE,START_SPRITE To END_SPRITE
P1 This is a superfast replacement for the original Psprite command.
Normally you have to define all Psprite's whithin a loop like this :
For I=START_SPRITE To END_SPRITE
Psprite I,ARRAY_X(I),ARRAY_Y(I),ARRAY_IMAGE(I)
Next I
This loop can be replaced with one command !
Psprite Varptr(ARRAY_X(N)),Varptr(ARRAY_Y(N)),Varptr(ARRAY_IMAGE(N)),
START_SPRITE To END_SPRITE
It looks very complicated and slow because of the use of the Varptr()
functions, but when compiled it is very effective and fast.
(I know this for sure, because I've examined the resulting compiled code...)
Varptr(N) is only returning the adress where the N th element of the array
is stored in memory. N doesn't have to be zero, you can start from any
element in the array, passing the values to the Psprite's.
It is also possible to use AMOS/Pro banks for storing the X/Y coordinates
and the Image of the Psprite's.
Beware, the X/Y and Image values stored in the banks have to be LONGWORDS
(32 bits).
It has been carefully optimised to give the best speed possible!
A few tests, normally done by the usual Psprite command, have been
ommited.
1) The lenght of the ARRAY's or Banks are not checked for !
So I advise you to test your program in the usual manner and, if
everything works fine, you can use the new version of the Psprite
command.
P4Psprite Off
P1
Psprite Off NR
Does the same thing as the Amos/Pro Sprite Off NR command...
Psprite Off START To END
Discard a range of Psprites.
Psprite Off
Does the same thing as the Amos/Pro Sprite Off command...
P4Psprite Update
P1
Psprite Update
This is a very powerfull updating command.
First it checks if the maximum amount of Psprites <= 8, if so
the Psprite images are copied directly to their corresponding
sprite DMA-channels.
If the maximum amount of Psprites >8 and the number of actually
defined sprites with the Psprite command is <=8, the Psprite images
are copied directly to the sprite DMA-channels without sorting.
In any other case the Psprites are first sorted on their Y-coordinates.
Then every Psprite is checked if it can be fitted in a particular
sprite DMA-channel.
It is possible to have 128 Psprites on screen using only 1 sprite
DMA-channel!
P3PowerSprite functions.
----------------------
P4
=X Psprite()
P1
HARD_XCOOR=X Psprite(NR)
Returns the actual hardware X coordinate for Psprite NR
P4=Y Psprite()
P1
HARD_YCOOR=Y Psprite(NR)
Returns the actual hardware Y coordinate for Psprite NR
P3Bob and Bob to Sprite collision detection.
==========================================
P4
=Pbob Fastcol()
P1
RESULT=Pbob Fastcol(PBOB,STARTPBOB To ENDPBOB)
Does the same thing as the Bob Col function except that I use
coordinate checking.
This method is much faster than using the BLITTER to check if a
collision has occured, but is not so accurate.
It can be used even if the BOB's have no mask.
RESULT=Pbob Fastcol(BOB To OTHER_BOB)
This one is handy if you want to detect a collision between two BOB's.
It does the same thing as Pbob Fastcol(PBOB,OTHER_PBOB To OTHER_PBOB) but
is a bit faster.
Since you are only checking for collision between one PBOB and another PBOB,
the flag in the collision array is not set.
This means that the Pfast Bobcol() function is useless in this case.
P4=Pbobsprite Fastcol()
P1
RESULT=Pbobsprite Fastcol(PBOB,START_PSPRITE To END_PSPRITE)
Does the same thing as the Bobsprite Col function except that I use
coordinate checking.
This method is much faster than using the BLITTER to check if a
collision has occured, but is not so accurate.
It can be used even if the PBOB's and PSPRITE's have no mask.
RESULT=Pbobsprite Fastcol(PBOB To PSPRITE)
This one is handy if you want to detect a collision between a PBOB and
one PSPRITE.
It does the same thing as Pbobsprite Fastcol(PBOB,PSPRITE To PSPRITE) but
is a bit faster.
Since you are only checking for collision between one PBOB and another PSPRITE,
the flag in the collision array is not set.
This means that the Pfast BobCol() function is useless in this case.
P4=Pfast Bobcol()
P1
NR=Pfast Bobcol(BOB_NR)
Does the same thing as the Col(BOB_NR) function in AMOS/Pro.
But it only works when using Pbobs!
To be used when doing FAST collision detection.
P4=Pfast Bobsprcol()
P1
NR=Pfast Bobsprcol(BOB_NR)
Does the same thing as the Col(SPRITE_NR) function in AMOS/Pro.
But it only works when using Pbobs and Psprites!
To be used when doing FAST collision detection.
P3Sprite and Sprite to Bob collision detection.
=============================================
P4
=Psprite Fastcol()
P1
RESULT=Psprite Fastcol(PSPRITE,STARTPSPRITE To ENDPSPRITE)
Does the same thing as the Sprite Col function except that I use
coordinate checking.
This method is much faster than using the BLITTER to check if a
collision has occured, but is not so accurate.
It can be used even if the PSPRITE's have no mask.
RESULT=Psprite Fastcol(PSPRITE To OTHER_PSPRITE)
This one is handy if you want to detect a collision between two PSPRITE's.
It does the same thing as
Psprite Fastcol(PSPRITE,OTHER_PSPRITE To OTHER_PSPRITE) but is a bit faster.
Since you are only checking for collision between one PSPRITE and another
PSPRITE, the flag in the collision array is not set.
This means that the Pfast Sprcol() function is useless in this case.
P4=Pfast Sprcol()
P1
NR=Pfast Sprcol(PSPRITE_NR)
Does the same thing as the Col(SPRITE_NR) function in AMOS/Pro.
But it only works when using Psprites!
To be used when doing FAST collision detection.
P4=Pspritebob Fastcol()
P1
RESULT=Pspritebob Fastcol(PSPRITE,STARTPBOB To ENDPBOB)
Does the same thing as the Spritebob Col function except that I use
coordinate checking.
This method is much faster than using the BLITTER to check if a
collision has occured, but is not so accurate.
It can be used even if the PSPRITE's/PBOB's have no mask.
RESULT=Pspritebob Fastcol(PSPRITE To PBOB)
This one is handy if you want to detect a collision between a PSPRITE and
one Pbob.
It does the same thing as
Pspritebob Fastcol(PSPRITE,OTHER_PBOB To OTHER_PPBOB) but is a bit faster.
Since you are only checking for collision between one PSPRITE and a
PBOB, the flag in the collision array is not set.
This means that the Pfast Sprbobcol() function is useless in this case.
P4=Pfast Sprbobcol()
P1
NR=Pfast Sprbobcol(PBOB_NR)
Does the same thing as the Col(BOB_NR) function in AMOS/Pro.
But it only works when using Psprites/Pbob's.
To be used when doing FAST collision detection.
As you can see, there are four functions to examine FAST collisions between
objects.
I also use four collision detection arrays, one for each type of collision
checking.
It provides a method of keeping the collisions between different types of
objects,Pbobs or Psprites, separated.
This whas simply not possible with the AMOS/Pro original Col() function!
P3PowerBob Amal support.
======================
P4Pchannel To Pbob
P1
Pchannel To Pbob AMAL_CHANNEL To PBOB_NR
Assigns Pbob PBOB_NR to Channel AMAL_CHANNEL.
As normal with Amal programs, the X/Y and A variables define the
Pbob X/Y coordinates and it's image.
It is important to assign the channel(s) to the Pbob(s) after the
Amal CHAN_NR,ANIM$
Also the X/Y and A values must be declared within the Amal program!
This means that the Amal driven Pbob's don't require initial values.
These are transferred by the Psync Pbob command.
P4Psync Pbob
P1
Psync Pbob START_BOB To END_BOB
It does the same thing as the Amos/Pro Synchro command, but as an
additional bonus a range of Pbobs can be updated, this is :
the new X/Y and A values are transferred to the Pbobs.
It whas also necessary to include a range to be compatible with the
new 25 frames per second mode.
You still have to call the Pbob Update or the Pbob Clear/Draw duo
to update your Pbobs on screen.
Beware ! The Psync Pbob command has to be executed in the screen
where the Pbobs are to be displayed !
This is because a part of the Clipping routine is done inside the
Psync Pbob command.
P4Psync Every Pbob
P1
Psync Every Pbob FRAME_COUNT
Normally the Psync Pbob transfers the X/Y and A values every time the
Psync Pbob command is called, this is the default mode.
In some occasions it is preferable to update these values at a slower
rate. The FRAME_COUNT delay ranges from 1 to 32767.
P3PowerSprite Amal support.
=========================
P1
P4Pchannel To Psprite
P1
Pchannel To Psprite AMAL_CHANNEL To PSPRITE_NR
Assigns Psprite PSPRITE_NR to Channel AMAL_CHANNEL.
As normal with Amal programs, the X/Y and A variables define the
Psprite X/Y coordinates and it's image.
It is important to assign the channel(s) to the Psprite(s) after the
Amal CHAN_NR,ANIM$
Also the X/Y and A values must be declared within the Amal program!
P4Psync Psprite
P1
Psync Ppsprite START_SPRITE To END_SPRITE
It does the same thing as the Amos/Pro Synchro command for Sprites, but as an
additional bonus a range of Psprites can be updated, this is :
the new X/Y and A values are transferred to the Psprites.
You don't have to execute the Psprite Update command, because it is auto-
matically performed within the Psync Psprite command!
It whas necessary to include a range because you are limited to only 64
Amal channels that can control the Psprites with an Amal program.
But as you allready know, the Psprite system can display upto 128 Psprites
on a single screen.
What you can do is :
Set up 64 Amal channels that will control the first 64 Psprites in the usual
manner.
Then create a Procedure that will handle the rest of the Psprites in
normal AMOS/Pro code, using the Psprite NR,X,Y,IMAGE command.
Execute this Procedure BEFORE the Psync Psprite command and then call the
Psync Psprite command.
Ex.: Proc _SET_UP_PSPRITE_AMAL_CHANNELS_0_TO_63
Proc _SET_UP_PSPRITES_64_TO_127_IN_AMOS/PRO_CODE
Repeat
Proc _GET_SOME_INPUT_FROM_THE_USER
Proc _CHANGE_COORDINATES_OF_PSPRITES_64_TO_127
Psync Psprite 0 To 63
Until BORED=True
P4Psync Every Psprite
P1
Psync Every Psprite FRAME_COUNT
Normally the Psync Psprite transfers the X/Y and A values every time the
Psync Psprite command is called, this is the default mode.
In some occasions it is preferable to update these values at a slower
rate. The FRAME_COUNT delay ranges from 1 to 32767.
P3Additional commands and functions.
==================================
P1
P4Psync Every
P1
Psync Every FRAME_COUNT
This command will synchronize the Pbob's and Psprite's at the same FRAME_COUNT.
But it is more effective to synchronise them at different FRAME_COUNTS,
if you are displaying lot's of Pbob's and Psprite's on screen.
Ex.: The main characters are Psprite's, so you want to display them as smooth
as possible, because your eyes are following them most of the time.
The other characters (the ennemies) are Pbob's that are only displayed to
kill them and are not followed constantly by your eyes.
You just aim at them and shoot.
But since the main characters are updated at 50 frames per second, the overall
gameplay will be very smooth.
P4Set 68020 Amal
P1
Set 68020 Amal CHANNEL,AMAL$
When AMOS The Creator came out, most of the Amiga computers where equipped
with the allready powerfull but limited MC68000 processor.
He could not have foreseen that many companies where going to design a wide
variety of accelerator boards and that later Amiga's would be equipped
with faster processors.
F. Lionet, the author of the package, knew about these limitations and
decided that no more than 16 Amal programs should be run under interrupts
without a possible crash of the system.
If you are the lucky owner of an accelerator board or a fast Amiga you
are now able to use all this power to execute even more Amal programs
under interrupts!
The command format has not changed, but you are now able to run all
64 channels under interrupts.
So you don't have to use the Synchro Off command when setting up your
Amal programs!
If you are one of those lucky guys, I advise you to make two versions
of your programs :
1) one that will run on a standard machine.
2) one designed for all those other faster Amiga's.
Progams using 64 channels under interrupts will work on :
standard A3000 68(EC)030 processor available.
standard A1200 68EC020 processor available.
standard A4000/30 68(EC)030 processor available.
standard A4000/40 68(LC)040 processor available.
standard A500 and A500+ with 68(EC)020 or higher accelerator board.
standard A600 with 68(EC)020 or higher accelerator board.
standard A2000 with 68(EC)020 or higher accelerator board.
standard A1000 with 68(EC)020 or higher accelerator board.
(EC) means : with or without MMU.
(LC) means : with or without FPU.
The could be working on :
standard A500 and A500+ with 68000 clocked at 14Mhz or higher with FASTRAM.
standard A600 with 68000 clocked at 14Mhz or higher with FASTRAM.
standard A2000 with 68000 clocked at 14Mhz or higher with FASTRAM.
standard A1000 with 68000 clocked at 14Mhz or higher with FASTRAM.
P4=Xscr Sprite()
P1
XSCREEN_COORD=Xscr Sprite(NR)
This is a full replacement for XSCREEN_COORD=X Screen(X Sprite(NR)).
P4=Yscr Sprite()
P1
YSCREEN_COORD=Yscr Sprite(NR)
This is a full replacement for YSCREEN_COORD=Y Screen(Y Sprite(NR)).
P4=Xscr Mouse
P1
XSCREEN_COORD=Xscr Mouse
This is a full replacement for XSCREEN_COORD=X Screen(X Mouse).
P4=Yscr Mouse
P1
YSCREEN_COORD=Yscr Mouse
This is a full replacement for YSCREEN_COORD=Y Screen(Y Mouse).
P3Array arithmetics.
------------------
P1
P4Pinc
P1
Pinc ARRAY1,START_ELEMENT To END_ELEMENT
This is a superfast replacement for the original Inc command.
The values from an array can be incremented in one go!
Normally you have to increment all array elements whithin a loop like this:
For I=START_ELEMENT To END_ELEMENT
Inc X(I)
Next I
This loop can be replaced with one command !
Pinc Varptr(X(0)),START_ELEMENT To END_ELEMENT
It looks very complicated and slow because of the use of the Varptr()
functions, but when compiled it is very effective and fast.
Varptr(0) is only returning the adress where element 0 (zero) of the array
is stored in memory.
Beware! You MUST use Varptr(ARRAY(0)), START_ELEMENT and END_ELEMENT define
the range of the variables that will be incremented.
The only limitation is that only elements 0 through 16383 can be incremented.
It is also possible to use AMOS/Pro banks instead of array's.
Beware! The values stored in the banks have to be LONGWORDS (32 bits).
P4Set Pinc Range
P1
Set Pinc Range BOTTOM To TOP
This command sets the range for the Pinc command.
If you want to change for example the bottom value without changing the other
range, you can use the Same function.
Ex.: 1) Normal AMOS/Pro code.
Dim X(100)
For I=1 To 100
Add X(I),1,0 To 319
Next I
2) PowerBob code.
Dim X(100),Y(100)
Set Pinc Range 0 To 319
Pinc Varptr(X(0)),1 To 100
P4Unset Pinc Range
P1
Unset Pinc Range
With this command you can discard the ranges that are used with the
Pinc command.
Ex.: Set Pinc Range 10 To 20
'Set a range when using Pinc.
Unset Pinc Range
'Unset the range when using Pinc.
Beware!
The Unset command does NOT clear the range values, they are only cleared
when doing a Default or Run.
P4Pdec
P1
Pdec ARRAY1,START_ELEMENT To END_ELEMENT
This is a superfast replacement for the original Dec command.
The values from an array can be decremented in one go!
Look at the Pinc command for more information.
P4Set Pdec Range
P1
Set Pdec Range BOTTOM1 To TOP1
This command sets the range for the Pdec command.
If you want to change for example the bottom value without changing the other
range, you can use the Same function.
Ex.: 1) Normal AMOS/Pro code.
Dim X(100)
For I=1 To 100
Add X(I),1,10 To 255
Next I
2) PowerBob code.
Dim X(100)
Set Pdec Range 10 To 255
Pdec Varptr(X(0)),1 To 100
P4Unset Pdec Range
P1
Unset Pdec Range NR
With this command you can discard the ranges that are used with the
Pdec command.
P4Padd
P1
Padd ARRAY1,VALUE1,START_ELEMENT To END_ELEMENT
This is a superfast replacement for the original Add command.
Beware! You MUST use Varptr(ARRAY(0)), START_ELEMENT and END_ELEMENT define
the range of the variables that will be added with the correspondent values.
Normally you have to add a value to all array elements whithin a loop
like this:
For I=START_ELEMENT To END_ELEMENT
Add X(I),VALUE1
Next I
This loop can be replaced with one command !
Padd Varptr(X(0)),VALUE1,START_ELEMENT To END_ELEMENT
Beware! You MUST use Varptr(ARRAY(0)), START_ELEMENT and END_ELEMENT define
the range of the variables that will be added with VALUE1
The only limitation is that only elements 0 through 16383 can be added.
It is also possible to use AMOS/Pro banks instead of array's.
The values stored in the banks have to be LONGWORDS (32 bits).
P4Set Padd Range
P1
Set Padd Range BOTTOM1 To TOP1
This command sets the range for the Padd command.
If you want to change for example the bottom value without changing the other
range, you can use the Same function.
Ex.: 1) Normal AMOS/Pro code.
Dim X(100),Y(100)
For I=1 To 100
Add X(I),10,0 To 319
Next I
2) PowerBob code.
Dim X(100),Y(100)
Set Padd Range 0 To 319
Padd Varptr(X(0))10,1 To 100
P4Unset Padd Range
P1
Unset Padd Range NR
With this command you can discard the ranges that are used with the
Padd command.
P4Psum
P1
Psum ARRAY1,ARRAY2,START_ELEMENT To END_ELEMENT
This is a superfast replacement for adding the values of ARRAY2 to ARRAY1.
Normally you have to add a two array's whithin a loop like this:
For I=START_ELEMENT To END_ELEMENT
Add X(I),X_OFFSET(I)
Next I
This loop can be replaced with one command !
Psum Varptr(X(0)),Varptr(X_OFFSET(0)),START_ELEMENT To END_ELEMENT
Beware! You MUST use Varptr(ARRAY(0)), START_ELEMENT and END_ELEMENT define
the range of the variables that will be added to eachother.
The only limitation is that only elements 0 through 16383 can be summed.
It is also possible to use AMOS/Pro banks instead of array's.
The values stored in the banks have to be LONGWORDS (32 bits).
P4Set Psum Range
P1
Set Psum Range BOTTOM1 To TOP1
This command sets the range for the Psum command.
If you want to change for example the bottom value without changing the other
range, you can use the Same function.
P4Unset Psum Range
P1
Unset Psum Range NR
With this command you can discard the ranges that are used with the
Psum command.
P4=Same
P1
=Same
Use of the Same function.
Set Pinc Range 0 To 100
Set Pinc Range Same To 300
This one will leave the bottom value for array 1 unchanged, but will
initialise the TOP value to 300.
P4Pmul
P1
Pmul ARRAY1,ARRAY2,START_ELEMENT To END_ELEMENT
This is a superfast replacement for multiplying the values in ARRAY1 with
ARRAY2. The results are placed in ARRAY1.
P4Pmul shift
P1
Pmul Shift RESULT,ARRAY,FACTOR,SHIFT,START_ELEMENT To END_ELEMENT
This command can be handy when doing some scaled arithmetic.
All values defined by START_ELEMENT to END_ELEMENT of ARRAY1 are multiplied by
FACTOR and shifted 2^SHIFT places to the right. The results are placed in
array RESULT.
Ex.: Normal AMOS/Pro code.
Dim RESULT(100),ARRAY(100),FACTOR(360)
SHIFT=8
SCALED=2^8 : Rem 256
For I=0 To 360
FACTOR(I)=Cos(I)*SCALED
Next I
ANGLE=36
For I=1 To 100
RESULT(I)=ARRAY(I)*FACTOR(ANGLE)/SCALED
Next I
Enhanced PowerBobs code.
Pmul Shift Varptr(RESULT(0)),Varptr(ARRAY(0)),FACTOR(ANGLE),SHIFT,1 To 100
Beware! Make sure that the resulting array can hold the range of values
defined by START_ELEMENT to END_ELEMENT.
P3Additional information.
=======================
P1
Since this extension is still growing and changing, I advise you to
save all your programs in ASCII format with separate graphic banks.
You are warned !!!
The Pbob Update command :
The updating process is divided into 3 stages.
1) Background replacement.
2) Background saving.
This is only done if the X/Y coordinates or the Pbob IMAGE width/height
have changed since the last update.
3) Image drawing.
This is performed every time for all Pbob's.
The Pbob Clear command :
The background is replaced every time for all Pbob's from their
safe places.
The Pbob Draw command :
The drawing process is divided into 2 stages.
1) Define the area where the Pbob's will be displayed and
copy this area to a safe place.
2) Draw the images for all Pbob's.
So the Pbob Clear/Draw should be used when a lot of changes are done
onto the screen.
Ex.:
Do
Pbob Clear START_BOB To END_BOB
'do all other drawing stuff...
Pbob Draw START_BOB To END_BOB
Loop